package com.bwf.obj;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/13 9:58
 * @Copyright 博为峰
 */
public class ObjectDemo {
    public static void main(String[] args) {
        Student s1 = new Student("张三", 20);
        Student s2 = new Student("张三", 30);
//        System.out.println(s1 == s2);//比较地址
//        System.out.println(s1.equals(s2));

//        System.out.println(s1.hashCode());//1163157884
//        System.out.println(Integer.toHexString(s1.hashCode()));//4554617c
//        System.out.println(s1);//com.bwf.obj.Student@4554617c
//        System.out.println(s2.hashCode());

        /*
           判断两个对象是否是同一个
           1.数据相同
           2.hash值相同
         */

        System.out.println(s2);
        System.out.println(s2.toString());


    }
}
